/**
 * <AiRmob-Framework; A simple augmented reality framework for android >
    Copyright (C) <2012>  <AiRmob Team>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package rendercomponents;

public class ModelCustom extends Model3D {

	protected String path;

	float ambient[] = { 0.4f, 0.4f, 0.4f, 1.0f };

	float diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };

	float specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };

	float specular_exponent = 10.0f;

	/**
	 * Constructs a modelCustom. Therefore the external-file specifies in path
	 * will be imported.
	 * 
	 * @param r
	 *            the used renderer
	 * @param path
	 *            the patch where the model-file is located (on the device)
	 * @param type
	 *            the type of the model-file is
	 */
	public ModelCustom(Renderer r, String path, ModelFileTypes type) {
		super();
		this.path = path;
		this.setMaterialAmbient(ambient);
		this.setMaterialDiffuse(diffuse);
		this.setMaterialExponent(specular_exponent);
		this.setMaterialSpecular(specular);
		this.loadModel(r, path, type, r.settings.useVBO);
	}

	protected ModelCustom() {
		super();
	}

	private void loadModel(Renderer r, String path, ModelFileTypes type,
			boolean useVBO) {
		if (type == ModelFileTypes.OBJ)
			r.resourceManager.loadModelFromOBJ(path, this, useVBO);
		else
			return;
	}

}
